home *** CD-ROM | disk | FTP | other *** search
/ Treccani Italiana Di Scienze Lettere Ed Arti / [Enciclopedia] Treccani Italiana di scienze lettere ed arti.iso / pc / data / xxi_appendice_dvd.swf / scripts / __Packages / CAppendiceToolbar.as < prev    next >
Text File  |  2007-11-08  |  10KB  |  335 lines

  1. class CAppendiceToolbar extends mx.core.UIObject
  2. {
  3.    function CAppendiceToolbar()
  4.    {
  5.       super();
  6.       this.mInitialized = false;
  7.       this.mUseLiquidFlash = false;
  8.       this.init();
  9.       this.doLater(this,"initCallback");
  10.    }
  11.    function init()
  12.    {
  13.       this.mc_btnGroup._visible = true;
  14.       this.mc_btnGroup._alpha = 100;
  15.       this.mc_GrabRect._visible = false;
  16.       this.mc_OptionGrabRect._visible = false;
  17.       this.mc_GrabRect._alpha = 10;
  18.       this.mc_OptionGrabRect._alpha = 0;
  19.       this.mc_btnGroup.cbtn_Indietro.disable();
  20.       this.mc_btnGroup.cbtn_Avanti.disable();
  21.       this.mc_btnGroup.cbtn_Cronologia.disable();
  22.       this.mc_btnGroup.cbtn_Stampa.disable();
  23.       this.mc_btnGroup.cbtn_Copia.disable();
  24.    }
  25.    function EnableButton(inButton, inEnabled)
  26.    {
  27.       if(this.mc_btnGroup[inButton])
  28.       {
  29.          this.mc_btnGroup[inButton].SetEnabled(inEnabled);
  30.       }
  31.    }
  32.    function initCallback()
  33.    {
  34.       this.mc_btnGroup.cbtn_Indietro.disable();
  35.       this.mc_btnGroup.cbtn_Avanti.disable();
  36.       this.mc_btnGroup.cbtn_Cronologia.disable();
  37.       this.mc_btnGroup.cbtn_Opzioni.SetCallBack(this,this.onOpzioniClick);
  38.       this.mc_btnGroup.cbtn_Stampa.SetCallBack(this,this.onStampaClick);
  39.       this.mc_btnGroup.cbtn_Copia.SetCallBack(this,this.onCopiaClick);
  40.       this.mc_btnGroup.cbtn_Indietro.SetCallBack(this,this.onBackClick);
  41.       this.mc_btnGroup.cbtn_Avanti.SetCallBack(this,this.onNextClick);
  42.       this.mc_btnGroup.cbtn_Cronologia.SetCallBack(this,this.onShowHistoryClick);
  43.       this.mc_btnGroup.cbtn_Aiuto.SetCallBack(this,this.onHelpClick);
  44.       this.mc_btnGroup.cbtn_Prospettive.SetCallBack(this,this.onProspettiveClick);
  45.       this.mc_btnGroup.cbtn_Ricerca.SetCallBack(this,this.onRicercaClick);
  46.       this.mc_MenuCronologia.addEventListener("scrollableMenuItemSelected",mx.utils.Delegate.create(this,this.onCronologiaItemSelected));
  47.       this.mc_OptionMenu.addEventListener("scrollableMenuItemSelected",mx.utils.Delegate.create(this,this.onOptionMenuItemSelected));
  48.       this.mc_MenuCronologia.setIconFunction(this.IconManager);
  49.       this.mc_MenuCronologia.setCellRenderer("HtmlMenuCellRenderer",_global.gUseEmbeddedFont);
  50.       this.mc_OptionMenu.setCellRenderer("EmbedHtmlMenuCellRenderer",true);
  51.       if(!this.mUseLiquidFlash)
  52.       {
  53.          this.InitGrabRect(this.mc_GrabRect);
  54.       }
  55.       if(!this.mUseLiquidFlash)
  56.       {
  57.          this.InitGrabRect(this.mc_OptionGrabRect);
  58.       }
  59.       this.mInitialized = true;
  60.    }
  61.    function RefreshHistoryButton(inHistoryObj)
  62.    {
  63.       var _loc2_ = inHistoryObj.GetLength();
  64.       var _loc3_ = inHistoryObj.GetPosition();
  65.       this.mc_btnGroup.cbtn_Indietro.SetEnabled(_loc3_ > 0 && _loc2_ > 0);
  66.       this.mc_btnGroup.cbtn_Avanti.SetEnabled(_loc3_ < _loc2_ - 1 && _loc2_ > 0);
  67.       this.mc_btnGroup.cbtn_Cronologia.SetEnabled(_loc2_ > 0);
  68.    }
  69.    function onOpzioniClick()
  70.    {
  71.       this.ShowSubMenuGrab(this.NextFrame);
  72.       this.gotoAndPlay("OPZIONI");
  73.    }
  74.    function onCopiaClick()
  75.    {
  76.       this.ShowSubMenuGrab(this.NextFrame);
  77.       this.gotoAndPlay("COPIA");
  78.    }
  79.    function onStampaClick()
  80.    {
  81.       if(!_root.gAppendiceSearch)
  82.       {
  83.          return undefined;
  84.       }
  85.       var _loc3_ = _root.gAppendiceSearch.Print("");
  86.       if(_loc3_)
  87.       {
  88.          this.ShowSubMenuGrab(this.NextFrame);
  89.          ┬º┬ºpush(this.gotoAndPlay("STAMPA"));
  90.       }
  91.    }
  92.    function onBackClick()
  93.    {
  94.       if(_root.gAppendiceSearch)
  95.       {
  96.          _root.gAppendiceSearch.HistoryBack();
  97.       }
  98.    }
  99.    function onNextClick()
  100.    {
  101.       if(_root.gAppendiceSearch)
  102.       {
  103.          _root.gAppendiceSearch.HistoryNext();
  104.       }
  105.    }
  106.    function onShowHistoryClick()
  107.    {
  108.       this.ShowSubMenuGrab(this.HideSubMenuGrab);
  109.       if(_root.gAppendiceSearch)
  110.       {
  111.          this.mc_MenuCronologia.Show(_root.gAppendiceSearch.GetHistoryData(),-1);
  112.       }
  113.    }
  114.    function onHelpClick()
  115.    {
  116.       if(_root.gAppendiceSearch)
  117.       {
  118.          _root.gAppendiceSearch.Aiuto();
  119.       }
  120.    }
  121.    function onProspettiveClick()
  122.    {
  123.       if(_root.gAppendiceSearch)
  124.       {
  125.          _root.gAppendiceSearch.MenuProspettive(true);
  126.       }
  127.    }
  128.    function onRicercaClick()
  129.    {
  130.       if(_root.gAppendiceSearch)
  131.       {
  132.          _root.gAppendiceSearch.Ricerca();
  133.       }
  134.    }
  135.    function InitGrabRect(inClip)
  136.    {
  137.       var _loc2_ = {x:0,y:0};
  138.       inClip.globalToLocal(_loc2_);
  139.       inClip._x = _loc2_.x;
  140.       inClip._y = _loc2_.y;
  141.       inClip._width = Stage.width;
  142.       inClip._height = Stage.height;
  143.       inClip.useHandCursor = false;
  144.    }
  145.    function ShowSubMenuGrab(inCallback)
  146.    {
  147.       if(this.mUseLiquidFlash)
  148.       {
  149.          this.InitGrabRect(this.mc_GrabRect);
  150.       }
  151.       if(inCallback)
  152.       {
  153.          this.mc_GrabRect.onPress = mx.utils.Delegate.create(this,inCallback);
  154.       }
  155.       else
  156.       {
  157.          this.mc_GrabRect.onPress = mx.utils.Delegate.create(this,this.HideSubMenuGrab);
  158.       }
  159.       this.mc_GrabRect._visible = true;
  160.    }
  161.    function ShowOptionMenuGrab(inCallback)
  162.    {
  163.       if(this.mUseLiquidFlash)
  164.       {
  165.          this.InitGrabRect(this.mc_OptionGrabRect);
  166.       }
  167.       if(inCallback)
  168.       {
  169.          this.mc_OptionGrabRect.onPress = mx.utils.Delegate.create(this,inCallback);
  170.       }
  171.       else
  172.       {
  173.          this.mc_OptionGrabRect.onPress = mx.utils.Delegate.create(this,this.HideOptionMenuGrab);
  174.       }
  175.       this.mc_OptionGrabRect._visible = true;
  176.    }
  177.    function HideSubMenuGrab()
  178.    {
  179.       this.HideOptionMenuGrab();
  180.       this.mc_GrabRect._visible = false;
  181.       if(this.mUseLiquidFlash)
  182.       {
  183.          this.mc_GrabRect._x = 0;
  184.          this.mc_GrabRect._y = 0;
  185.          this.mc_GrabRect._xscale = this.mc_GrabRect._yscale = 100;
  186.       }
  187.       this.mc_MenuCronologia.Hide();
  188.    }
  189.    function HideOptionMenuGrab()
  190.    {
  191.       this.mc_OptionGrabRect._visible = false;
  192.       if(this.mUseLiquidFlash)
  193.       {
  194.          this.mc_OptionGrabRect._x = 0;
  195.          this.mc_OptionGrabRect._y = 0;
  196.          this.mc_OptionGrabRect._xscale = this.mc_OptionGrabRect._yscale = 100;
  197.       }
  198.       this.mc_OptionMenu.Hide();
  199.       this.mc_OptionMenu.mc_MenuListbox.removeAll();
  200.    }
  201.    function NextFrame()
  202.    {
  203.       this.HideOptionMenuGrab();
  204.       this.gotoAndPlay(this._currentframe + 1);
  205.    }
  206.    function onCronologiaItemSelected(evtObj)
  207.    {
  208.       if(_root.gAppendiceSearch)
  209.       {
  210.          _root.gAppendiceSearch.HistoryGoto(evtObj.selectedItemIndex);
  211.       }
  212.       this.HideSubMenuGrab();
  213.    }
  214.    function onOptionMenuItemSelected(evtObj)
  215.    {
  216.       var _loc4_ = evtObj.data.id;
  217.       if(_loc4_ == "big" || _loc4_ == "small" || _loc4_ == "normal")
  218.       {
  219.          _global.gStyleManager.SetView(_loc4_);
  220.       }
  221.       else if(_loc4_ == "saveAll" || _loc4_ == "saveVisible")
  222.       {
  223.          _root.gAppendiceSearch.Save(_loc4_);
  224.       }
  225.       else if(_loc4_ == "copyAll" || _loc4_ == "copyVisible")
  226.       {
  227.          _root.gAppendiceSearch.Copy(_loc4_);
  228.       }
  229.       this.HideOptionMenuGrab();
  230.    }
  231.    function IconManager(itemObj)
  232.    {
  233.       if(itemObj == undefined)
  234.       {
  235.          return undefined;
  236.       }
  237.       switch(itemObj.tipo)
  238.       {
  239.          case "L":
  240.             return "lemmaIcon";
  241.          case "R":
  242.             return "rinvioIcon";
  243.          case "T":
  244.             return "tabIcon";
  245.          case "I":
  246.             return "imageIcon";
  247.          case "F":
  248.             return "imageIcon";
  249.          case "P":
  250.             return "prospettivaIcon";
  251.          default:
  252.             return "emptyIcon";
  253.       }
  254.    }
  255.    function onSalvaSuFileClick()
  256.    {
  257.       if(!_root.gAppendiceSearch)
  258.       {
  259.          return undefined;
  260.       }
  261.       var _loc4_ = _root.gAppendiceSearch.Save("");
  262.       if(_loc4_)
  263.       {
  264.          var _loc3_ = new Array();
  265.          _loc3_.push({label:"intera voce",id:"saveAll"});
  266.          _loc3_.push({label:"capitolo mostrato",id:"saveVisible"});
  267.          this.mc_OptionMenu._x = 197;
  268.          this.mc_OptionMenu.SetWidth(111);
  269.          this.ShowOptionMenuGrab(null);
  270.          this.mc_OptionMenu.Show(_loc3_,-1);
  271.       }
  272.    }
  273.    function onCopiaInMemoriaClick()
  274.    {
  275.       if(!_root.gAppendiceSearch)
  276.       {
  277.          return undefined;
  278.       }
  279.       var _loc4_ = _root.gAppendiceSearch.Copy("");
  280.       if(_loc4_)
  281.       {
  282.          var _loc3_ = new Array();
  283.          _loc3_.push({label:"intera voce",id:"copyAll"});
  284.          _loc3_.push({label:"capitolo mostrato",id:"copyVisible"});
  285.          this.mc_OptionMenu._x = 81;
  286.          this.mc_OptionMenu.SetWidth(111);
  287.          this.ShowOptionMenuGrab(null);
  288.          this.mc_OptionMenu.Show(_loc3_,-1);
  289.       }
  290.    }
  291.    function onCaratteriClick()
  292.    {
  293.       var _loc3_ = new Array();
  294.       _loc3_.push({label:"piccoli",id:"small"});
  295.       _loc3_.push({label:"medi",id:"normal"});
  296.       _loc3_.push({label:"grandi",id:"big"});
  297.       this.mc_OptionMenu._x = 81;
  298.       this.mc_OptionMenu.SetWidth(111);
  299.       var _loc5_ = _global.gStyleManager.mCurrentView;
  300.       var _loc4_ = 1;
  301.       if(_loc5_ == "small")
  302.       {
  303.          _loc4_ = 0;
  304.       }
  305.       else if(_loc5_ == "big")
  306.       {
  307.          _loc4_ = 2;
  308.       }
  309.       this.ShowOptionMenuGrab(null);
  310.       this.mc_OptionMenu.Show(_loc3_,_loc4_);
  311.    }
  312.    function onCreditiClick()
  313.    {
  314.       this.HideOptionMenuGrab();
  315.       if(_root.gAppendiceSearch)
  316.       {
  317.          _root.gAppendiceSearch.Crediti();
  318.       }
  319.    }
  320.    function onStampaInteraVoce()
  321.    {
  322.       if(_root.gAppendiceSearch)
  323.       {
  324.          _root.gAppendiceSearch.Print("printAll");
  325.       }
  326.    }
  327.    function onStampaPorzioneMostrata()
  328.    {
  329.       if(_root.gAppendiceSearch)
  330.       {
  331.          _root.gAppendiceSearch.Print("printVisible");
  332.       }
  333.    }
  334. }
  335.